package uk.ac.glasgow.demosocs.tests;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import uk.ac.glasgow.demosocs.VotingSystem;
import uk.ac.glasgow.demosocs.impl.VotingSystemStub;

public class SetUser {
	
	private VotingSystem testVS;
	@Before
	public void setUp() throws Exception {
		testVS = new VotingSystemStub();
	}

	@After
	public void tearDown() throws Exception {
		testVS = null;
	}

	
	@Test
	/** test the authentication of a user
	 * the user in this example is valid
	 */
	public void testAuthValid() {
		boolean result = testVS.setCurrentUser("1", "p");
		assertTrue(result);
	}
	
	@Test
	/** test the authentication of a user
	 * the user in this example is not valid
	 */
	public void testAuthInvalid() {
		boolean result = testVS.setCurrentUser("456", "p13");
		assertFalse(result);
	}
	
	@Test
	/** test the authentication of a user
	 * the user in this example user is null
	 */
	public void testAuthNull() {
		boolean result = testVS.setCurrentUser(null, null);
		assertFalse(result);
	}

}